import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;


public class IOMaster {

    private IOMaster() {
    }

    public static Store readObject(String file) throws FileNotFoundException, IOException, ClassNotFoundException{
    	Store obj = null;
        FileInputStream fi = new FileInputStream(file);
        ObjectInputStream ois = new ObjectInputStream(fi);
        obj = (Store) ois.readObject();
        fi.close();
        return obj;
    }

    public static void writeObject(String file, Object obj) throws FileNotFoundException, IOException{
        FileOutputStream fo = new FileOutputStream(file);
        ObjectOutputStream oos  = new ObjectOutputStream(fo);
        oos.writeObject(obj);
        oos.flush();
        fo.close();
    }
}